﻿using MarkdownWeb.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MarkdownWeb.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<WikiContentContext>());
            var context = new WikiContentContext();
            if (context.Wikis.Count() == 0)
            {
                return new RedirectResult("/Home/Setup");
            }
            else
                return new RedirectResult("/首页");          
        }
        
        public ActionResult Setup()
        {
            return View();
        }
    }
}